﻿using B.S.BasicData.ErrorCode;
using B.S.BasicData.Read.Apilication.Common.leave;
using B.S.BasicData.Read.Apilication.Common.Report;
using B.S.BasicData.Read.DTOS;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.BasicData.Read.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]
    public class leaveController : ControllerBase
    {
        private readonly IMediator mediator;

        public leaveController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 审批列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiPaimg<LeaveDTO>> GetLeaveHandle([FromQuery]GetLeaveCommon request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 根据部门查领导
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<string>> GetDelparmentmanagerHandle([FromQuery]GetDelparmentmanagerCommon request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 报表查询
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<List<ReportDTO>>> GetleaveHandles([FromQuery]GetleavesummaryCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 报表详情
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<List<LeaveDateilDTO>>> GetleaveDetailHandle([FromQuery]GetleaveDetailCommon request)
        {
            return await mediator.Send(request);
        }



        }
}
